Next | Prev | Up | Top | Contents | Index

Default Behavior for Compiler Drivers

At compilation time, you can select one or more options that affect a variety of program development functions, including debugging, profiling, and optimizing. You can also specify the names assigned to output files. Note that some options have default values that apply if you do not specify them.

When you invoke a compiler driver with source files as arguments, the driver calls other commands that compile your source code into object code. It then optimizes the object code (if requested to do so) and links together the object files, the default libraries, and any other libraries you specify.

Given a source file foo.c, the default name for the object file is foo.o. The default name for an executable file is a.out. The following example compiles source files foo.c and bar.c with the default options:

cc foo.c bar.c

This example produces two object files (foo.o and bar.o), then links them with the default C library libc to produce an executable called a.out.

Note: If you compile a single source directly to an executable, the compiler does not create an object file.


Next | Prev | Up | Top | Contents | Index